/*     */ package com.zimbra.cs.index;
/*     */ 
/*     */ import java.util.Set;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ final class QueryTarget
/*     */ {
/*  27 */   public static final QueryTarget UNSPECIFIED = new QueryTarget();
/*  28 */   public static final QueryTarget LOCAL = new QueryTarget();
/*  29 */   public static final QueryTarget REMOTE = new QueryTarget();
/*     */   private final String target;
/*     */   
/*     */   private QueryTarget()
/*     */   {
/*  34 */     this.target = null;
/*     */   }
/*     */   
/*     */   QueryTarget(String target) {
/*  38 */     this.target = target;
/*     */   }
/*     */   
/*     */   boolean isCompatibleLocal()
/*     */   {
/*  43 */     return (this == UNSPECIFIED) || (this == LOCAL);
/*     */   }
/*     */   
/*     */   boolean isCompatible(String targetAcctId) {
/*  47 */     if (isCompatibleLocal()) {
/*  48 */       return false;
/*     */     }
/*  50 */     if (this == REMOTE) {
/*  51 */       return false;
/*     */     }
/*  53 */     return this.target.equals(targetAcctId);
/*     */   }
/*     */   
/*     */   public String toString()
/*     */   {
/*  58 */     if (this == UNSPECIFIED)
/*  59 */       return "UNSPECIFIED";
/*  60 */     if (this == LOCAL) {
/*  61 */       return "LOCAL";
/*     */     }
/*  63 */     return this.target;
/*     */   }
/*     */   
/*     */ 
/*     */   public boolean equals(Object other)
/*     */   {
/*  69 */     if (other == this) {
/*  70 */       return true;
/*     */     }
/*  72 */     if ((other != null) && (other.getClass() == getClass())) {
/*  73 */       QueryTarget o = (QueryTarget)other;
/*     */       
/*  75 */       if ((this.target == null) || (o.target == null)) {
/*  76 */         return this == other;
/*     */       }
/*     */       
/*  79 */       return this.target.equals(o.target);
/*     */     }
/*  81 */     return false;
/*     */   }
/*     */   
/*     */   public int hashCode()
/*     */   {
/*  86 */     return this.target != null ? this.target.hashCode() : 0;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   static int getExplicitTargetCount(Set<QueryTarget> set)
/*     */   {
/*  93 */     int count = 0;
/*  94 */     for (QueryTarget entry : set) {
/*  95 */       if (entry != UNSPECIFIED) {
/*  96 */         count++;
/*     */       }
/*     */     }
/*  99 */     return count;
/*     */   }
/*     */   
/*     */   static boolean hasExternalTarget(Set<QueryTarget> set) {
/* 103 */     for (QueryTarget entry : set) {
/* 104 */       if ((entry != UNSPECIFIED) && (entry != LOCAL)) {
/* 105 */         return true;
/*     */       }
/*     */     }
/* 108 */     return false;
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/index/QueryTarget.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */